<?php

namespace App\Common\Util\EasySearchMacro;

use App\Common\Interfaces\EasySearchMacroInterface;
use App\Common\Model\Model;
use App\Common\Util\EasySearch;
use think\db\Query;

/**
 * 回收站的搜索
 *
 * Class Trash
 */
class Trash implements EasySearchMacroInterface
{

    public function __invoke(Model|Query $builder, ...$params)
    {
        if (!EasySearch::query('is_delete')) {
            return;
        }

        $builder->onlyTrashed();
    }
}